<template>
  <div>
    <template v-if="data.typeName">
      <template v-if="['日期'].includes(data.typeName)">
        {{$moment(scope.row[data.prop]).format('YYYY-MM-DD')}}
      </template>
      <template v-else-if="['图标'].includes(data.typeName)">
        <i class="iconfont" :class="scope.row[data.prop]"/>
      </template>
      <template v-else>
        <form-box
          :form="scope.row"
          :prop="data.prop"
          :form-type="data.typeName"
          size="small"
          @click.stop
          @dblclick.stop
          @changeBtn="changeBtn"
        />
      </template>
    </template>
    <template v-else>
      <div :class="{
        textOh:tableSet && tableSet.tooltip.includes(data.prop)
      }">
        <is-data :data="scope.row[data.prop]"/>{{data.unit}}
      </div>
    </template>
  </div>
</template>

<script>
  import FormBox from "@/comModule/FormBox";
  import IsData from "@/comModule/IsData";
  export default {
    name: 'RowCellItem',
    //获取父级数据
    props: {
      data:{
        type:Object,
      },
      scope:{
        type:Object,
      },
      tableSet:{
        type:Object,
      },
      parentData:{
        type:Array,
      },
    },
    components: {
      IsData,
      FormBox

    },
    data() {
      return {

      }
    },
    mounted() {

    },
    computed: {

    },
    methods: {
      //表单提交
      changeBtn(val,valAll,name){
        this.$emit('changeBtn',val,valAll,name)
      },
    }
  }

</script>
<style lang="scss">
.textOh{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
</style>
